package com.financing.service.system;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.financing.model.system.Slider;
import com.financing.model.user.User;
import com.financing.service.BaseService;
import com.jfinal.plugin.activerecord.Page;

public class SliderService extends BaseService<User>{
	
	/**
	 * 查找所有可用轮播图
	 * @param type 
	 */
	public List<Slider> findEnable(String type) {
		return Slider.me.find("select * from slider where status='enable' and (type=? or type='all') order by dsporder desc",type); 
	}	 
	
	/** 
	 * 分页数据
	 */
	public Page<Slider> list(int page, int size, Map<String, String> map) {
		return Slider.me.paginate(page, size, buildSql("slider",Arrays.asList("type", "name", "status"),map," order by dsporder desc,status asc "));
	}
}
